package jiangzuo

import (
	"aifuture.cloud/hanlders"
	"aifuture.cloud/services/jiangzuo"
	"github.com/gin-gonic/gin"
)

type JiangzuoHandler struct {
}

func NewJiangzuoHandler() *JiangzuoHandler {
	return &JiangzuoHandler{}
}
func (t *JiangzuoHandler) List(c *gin.Context) {
	//查询实训项目信息
	//查询导师讲座信息
	//1.0 初始化讲座处理器
	mockJiangzuoInter := jiangzuo.NewJiangzuoMock()
	jiangzuoSvc := jiangzuo.NewJianguoSvc(mockJiangzuoInter)
	err, jianzuoinfo := jiangzuoSvc.List()
	hanlders.HandlerError(err, c)
	hanlders.SuccessResponseHandler(c, jianzuoinfo)
}
type JiangzuoDetailReq struct {
	JiangzuoId int `query:"jiangzuo_id" binding:"required"`
}
func (t *JiangzuoHandler) Detail(ctx *gin.Context) {
	//课程查询器
	var JiangzuoDetailReq JiangzuoDetailReq
	err := ctx.ShouldBind(&JiangzuoDetailReq)
	hanlders.HandlerError(err, ctx)
	mockQueryInteraptor := jiangzuo.NewJiangzuoMock()
	courseSvc := jiangzuo.NewJianguoSvc(mockQueryInteraptor) //注入课程查询器
	err, courseinfo := courseSvc.Detail(JiangzuoDetailReq.JiangzuoId)
	hanlders.HandlerError(err, ctx)
	hanlders.SuccessResponseHandler(ctx, courseinfo)
}
